package dao

import "context"

// Account 账号本体
type Account struct {
	Id int64 `grom:"primaryKey,autoIncrement"`
	// 用户账号
	Uid int64

	// account 账号
	Account int64 `gorm:"uniqueIndex:account_type"`
	Type    uint8 `gorm:"uniqueIndex:account_type"`

	Balance  int64
	Currency string `gorm:"comment 'CNY'"`

	Utime int64
	Ctime int64
}
type AccountActivity struct {
	Id int64 `grom:"primaryKey,autoIncrement"`
	// 用户账号
	Uid int64

	Biz   string `gorm:"index:biz_type_id"`
	BizId int64  `gorm:"index:biz_type_id;column:biz_id"`

	// account 账号
	Account     int64 `gorm:"index:account_type"`
	AccountType uint8 `gorm:"index:account_type;column:account_type"`

	// TYPE 入账还是出账
	Amount   int64
	Currency string `gorm:"comment 'CNY'"`
	Utime    int64
	Ctime    int64
}
type AccountDao interface {
	AddActivities(ctx context.Context, activities ...AccountActivity) error
	GetFirstAccount(ctx context.Context, biz string, id int64) error
}

func (Account) TableName() string {
	return "account"
}
func (AccountActivity) TableName() string {
	return "account_activity"
}
